The development of real-time functional magnetic resonance imaging (rtfMRI) methods for treating pain and opiod misuse in chronic pain. A system will be developed to control cravings and urges and/or training to enable the subjects to increase their self-control of their drug taking.